package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author Evad.Wu
 * @Description 爱企查-股东信息 映射
 * @date 2022-09-23
 */
@Setter
@Getter
@ToString(exclude = {"aiqichaHeaderPo"})
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_SHAREHOLDERS")

@Entity
@Table(name = "AIQICHA_SHAREHOLDERS")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-专利信息 映射")
public class AiqichaShareholdersPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = -5610212956150624357L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "股东ID")
    @TableField(value = "PERSON_ID")
    @Column(name = "PERSON_ID", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '股东ID'")
    private String personId;
    @Schema(description = "股东姓名")
    @TableField(value = "NAME")
    @Column(name = "NAME", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '股东姓名'")
    private String name;
    @Schema(description = "持股比例")
    @TableField(value = "SUB_RATE")
    @Column(name = "SUB_RATE", columnDefinition = "VARCHAR(32) COMMENT '持股比例'")
    private String subRate;
    @Schema(description = "认缴出资额")
    @TableField(value = "SUB_MONEY")
    @Column(name = "SUB_MONEY", columnDefinition = "VARCHAR(64) COMMENT '认缴出资额'")
    private String subMoney;
    @Schema(description = "认缴出资额（金额数）")
    @TableField(value = "SORT_COL")
    @Column(name = "SORT_COL", columnDefinition = "DECIMAL(12, 2) COMMENT '认缴出资额（金额数）'")
    private BigDecimal sortCol;
    @Schema(description = "认缴出资额（金额单位）")
    @TableField(value = "MONEY_UNIT")
    @Column(name = "MONEY_UNIT", columnDefinition = "VARCHAR(16) COMMENT '认缴出资额（金额单位）'")
    private String moneyUnit;
    @Schema(description = "实际出资额")
    @TableField(value = "PAIDIN_MONEY")
    @Column(name = "PAIDIN_MONEY", columnDefinition = "VARCHAR(64) COMMENT '实际出资额'")
    private String paidinMoney;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
